package com.example.cash_register.model;

import com.example.cash_register.controller.ErrRedirectException;

public abstract class AbsValidator {
    public String validate(String module,String redirectUrl,String val) {
        if(val == null) {
            throw new ErrRedirectException("val  为 null",module,redirectUrl);
        }
        val.trim();
        if(val.isEmpty()) {
            throw new ErrRedirectException("val 为 \"\"",module,redirectUrl);
        }
        return val;
    }
}
